using JGSY.CMS.LowCode.Platform.Domain.Entities;

namespace JGSY.CMS.LowCode.Platform.Application.DTOs
{
    /// <summary>
    /// 租户DTO
    /// </summary>
    public class TenantDto
    {
        public string TenantId { get; set; } = string.Empty;
        public string Name { get; set; } = string.Empty;
        public string? DisplayName { get; set; }
        public string? Description { get; set; }
        public string? SubDomain { get; set; }
        public string? CustomDomain { get; set; }
        public string Status { get; set; } = string.Empty;
        public string? SubscriptionPlan { get; set; }
        public DateTime? ExpiresAt { get; set; }
        public string? ContactEmail { get; set; }
        public string? ContactPhone { get; set; }
        public string TimeZone { get; set; } = "Asia/Shanghai";
        public string Language { get; set; } = "zh-CN";
        public string? LogoUrl { get; set; }
        public DateTime CreatedAt { get; set; }
        public DateTime UpdatedAt { get; set; }
    }

    /// <summary>
    /// 创建租户DTO
    /// </summary>
    public class CreateTenantDto
    {
        public string TenantId { get; set; } = string.Empty;
        public string Name { get; set; } = string.Empty;
        public string? DisplayName { get; set; }
        public string? Description { get; set; }
        public string? SubDomain { get; set; }
        public string? CustomDomain { get; set; }
        public string? SubscriptionPlan { get; set; }
        public DateTime? ExpiresAt { get; set; }
        public string? ContactEmail { get; set; }
        public string? ContactPhone { get; set; }
        public string? TimeZone { get; set; }
        public string? Language { get; set; }
        public string? LogoUrl { get; set; }
    }

    /// <summary>
    /// 更新租户DTO
    /// </summary>
    public class UpdateTenantDto
    {
        public string? Name { get; set; }
        public string? DisplayName { get; set; }
        public string? Description { get; set; }
        public string? SubDomain { get; set; }
        public string? CustomDomain { get; set; }
        public string? SubscriptionPlan { get; set; }
        public DateTime? ExpiresAt { get; set; }
        public string? ContactEmail { get; set; }
        public string? ContactPhone { get; set; }
        public string? TimeZone { get; set; }
        public string? Language { get; set; }
        public string? LogoUrl { get; set; }
    }

    /// <summary>
    /// 租户资源使用情况DTO
    /// </summary>
    public class TenantResourceUsage
    {
        public string ResourceType { get; set; } = string.Empty;
        public long CurrentUsage { get; set; }
        public long? Limit { get; set; }
        public decimal? UsagePercentage { get; set; }
        public string Unit { get; set; } = string.Empty;
    }

    /// <summary>
    /// 创建租户请求
    /// </summary>
    public class CreateTenantRequest
    {
        public string TenantId { get; set; } = string.Empty;
        public string Name { get; set; } = string.Empty;
        public string? DisplayName { get; set; }
        public string? Description { get; set; }
        public string? SubDomain { get; set; }
        public string? CustomDomain { get; set; }
        public string? SubscriptionPlan { get; set; }
        public string? Configuration { get; set; }
        public string? ResourceLimits { get; set; }
        public DateTime? ExpiresAt { get; set; }
        public string? ContactEmail { get; set; }
        public string? ContactPhone { get; set; }
        public string? TimeZone { get; set; }
        public string? Language { get; set; }
        public string? LogoUrl { get; set; }
        public string? ThemeConfiguration { get; set; }
    }

    /// <summary>
    /// 更新租户请求
    /// </summary>
    public class UpdateTenantRequest
    {
        public string? Name { get; set; }
        public string? DisplayName { get; set; }
        public string? Description { get; set; }
        public string? SubDomain { get; set; }
        public string? CustomDomain { get; set; }
        public string? SubscriptionPlan { get; set; }
        public string? Configuration { get; set; }
        public string? ResourceLimits { get; set; }
        public DateTime? ExpiresAt { get; set; }
        public string? ContactEmail { get; set; }
        public string? ContactPhone { get; set; }
        public string? TimeZone { get; set; }
        public string? Language { get; set; }
        public string? LogoUrl { get; set; }
        public string? ThemeConfiguration { get; set; }
    }

    /// <summary>
    /// 获取租户请求参数
    /// </summary>
    public class GetTenantsRequest : PagedRequest
    {
        /// <summary>
        /// 状态过滤
        /// </summary>
        public TenantStatus? Status { get; set; }

        /// <summary>
        /// 订阅计划过滤
        /// </summary>
        public string? SubscriptionPlan { get; set; }
    }

    /// <summary>
    /// 租户统计信息
    /// </summary>
    public class TenantStatistics
    {
        public int UserCount { get; set; }
        public int ArticleCount { get; set; }
        public long StorageUsage { get; set; }
        public DateTime LastActivityAt { get; set; }
    }
}
